home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PAS_0793 / FASTMOVE.PAS < prev    next >
Pascal/Delphi Source File  |  1993-08-01  |  1KB  |  35 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 340 of 351
  3. From : Chris Priede                        1:133/311.0          03 Jul 93  00:00
  4. To   : Justin Tawil
  5. Subj : Help in quick moves
  6. ────────────────────────────────────────────────────────────────────────────────
  7. JT>Does anyone have an Inline source for moving bytes a word or a double
  8. JT>word at a time..I need to copy data in and out of buffer very
  9. JT>quickly..Thanks..
  10.  
  11.  
  12.     ...of course...}
  13.  
  14.  
  15.     procedure IMove(var Src; var Dest; Count: word);
  16.     Inline(
  17.       $59/              {pop    cx}
  18.       $5F/              {pop    di}
  19.       $07/              {pop    es}
  20.       $5E/              {pop    si}
  21.       $8C/$DA/          {mov    dx, ds}
  22.       $1F/              {pop    ds}
  23.       $FC/              {cld}
  24.       $D1/$E9/          {shr    cx, 1}
  25.       $F3/$A5/          {rep    movsw}
  26.       $11/$C9/          {adc    cx, cx}
  27.       $F3/$A4/          {rep    movsb}
  28.       $8E/$DA           {mov    ds, dx}
  29.     );
  30.  
  31.  
  32.     Unlike TP's Move, this inline macro doesn't check if source and
  33. destination overlap. You will get most improvement if both source and
  34. destination are word-aligned, but it should be faster than Move in any
  35. case (no subroutine call).